package com.bensonbasement.snorflux.server.world.prototypes;

import com.bensonbasement.snorflux.server.world.Actor;
import com.bensonbasement.snorflux.server.world.BigEntity;
import com.bensonbasement.snorflux.server.world.World;

public final class ActorPrototype extends BigEntityPrototype {
	public static final ActorPrototype ACTOR;
	static {
		ACTOR = new ActorPrototype("core_actor",BigEntityPrototype.BIGENTITY);
	}
	
	private ActorPrototype(String prototypeID, BigEntityPrototype parent) {
		super(prototypeID, parent);
	}
	
	public ActorPrototype(String prototypeID, ActorPrototype parent) {
		super(prototypeID, parent);
	}
	
	private Integer maxAP = 20;
	private Integer apPerTurn = 15;
	
	public void setMaxAP(Integer maxAP) {
		this.maxAP = maxAP;
	}

	public Integer getMaxAP() {
		return maxAP;
	}
	
	public Integer findMaxAP() {
		if (maxAP != null) {
			return maxAP;
		}
		else {
			return ((ActorPrototype) this.getParent()).findMaxAP();
		}
	}
	
	public Integer getAPPerTurn() {
		return apPerTurn;
	}
	
	public void setAPPerTurn(Integer apPerTurn) {
		this.apPerTurn = apPerTurn;
	}
	
	public Integer findAPPerTurn() {
		if (apPerTurn != null) {
			return apPerTurn;
		}
		else {
			return ((ActorPrototype) this.getParent()).findAPPerTurn();
		}
	}
	
	@Override
	public Actor instantiate(World world) {
		Actor actor = new Actor(world, this);
		return actor;
	}
}
